package com.example.villagedevelop.generator.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.villagedevelop.generator.entity.Users;
import com.example.villagedevelop.generator.mapper.UsersMapper;
import com.example.villagedevelop.generator.service.UserService;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends ServiceImpl<UsersMapper, Users> implements UserService {

    @Override
    public int search(String id, String password) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("username",id);
        Users user = this.getOne(wrapper);
        int l = 0;
        if (user != null){
            if (user.getPassword().equals(password))
                return 2;//成功
            return 1;//密码错误
        }
        return 0;//未注册
    }


}
